package org.baixin.manager.impl;

import java.util.List;
import java.util.Map;

import org.apache.commons.collections.map.HashedMap;
import org.baixin.dao.UserDao;
import org.baixin.entity.User;
import org.baixin.manager.UserManager;
import org.hibernate.criterion.Criterion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 
 * @author slaton.wu@gmail.com
 * @version 1.0
 * @created 2011-6-19 下午02:49:22
 */
@Component
public class UserManagerImpl extends BaseManagerImpl<User, Long, UserDao>
		implements UserManager {

	/**
	 * @param entityDao
	 * @see org.baixin.manager.impl.BaseManagerImpl#setEntityDao(org.baixin.dao.base.HibernateDao)
	 */
	@Override
	@Autowired
	public void setEntityDao(UserDao entityDao) {
		this.entityDao = entityDao;
	}

	/**
	 * @param filters
	 * @return
	 * @see org.baixin.manager.UserManager#login(java.util.List)
	 */
	
	public User login(User user) {
		Map<String,Object> values = new HashedMap();
		values.put("loginName", user.getLoginName());
		values.put("pawd", user.getPawd());
		user = (User) entityDao.get(values);
		return user;
	}
	
	

}
